home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Games Collection 1
/
software vault.zip
/
software vault
/
CDR10
/
MAPEDIT.ZIP
/
MOUSE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-17
|
2KB
|
97 lines
#include <dos.h>
int mousebuttons() /* see if mouse buttons are pressed */
{
union REGS inregs;
union REGS outregs;
inregs.x.ax = 6;
int86(0x33,&inregs,&outregs);
return(outregs.x.ax );
}
int mousecheck() /* see if mouse exists, & # of buttons */
{
union REGS inregs;
union REGS outregs;
inregs.x.ax = 0;
int86(0x33,&inregs,&outregs);
return(outregs.x.ax ? outregs.x.bx : 0);
}
int mouseclick() /* see if mouse buttons were clicked */
{
int click = 0;
union REGS inregs;
union REGS outregs;
inregs.x.ax = 5;
inregs.x.bx = 1;
int86(0x33,&inregs,&outregs);
click = outregs.x.bx << 1;
inregs.x.bx--;
int86(0x33,&inregs,&outregs);
return(click | outregs.x.bx);
}
int mousecol() /* get column where mouse cursor is */
{
union REGS inregs;
union REGS outregs;
inregs.x.ax = 3;
int86(0x33,&inregs,&outregs);
return(outregs.x.cx>>1);
}
void mousecursor(toggle) /* turn mouse cursor on or off */
int toggle;
{
union REGS inregs;
union REGS outregs;
if (toggle) inregs.x.ax = 1;
else inregs.x.ax = 2;
int86(0x33,&inregs,&outregs);
}
void mouseloc(column,row) /* set location of mouse cursor */
int column, row;
{
union REGS inregs;
union REGS outregs;
inregs.x.ax = 4;
inregs.x.cx = row<<1;
inregs.x.dx = column;
int86(0x33,&inregs,&outregs);
}
int mouserow() /* get row where mouse cursor is */
{
union REGS inregs;
union REGS outregs;
inregs.x.ax = 3;
int86(0x33,&inregs,&outregs);
return(outregs.x.dx);
}
char mousemove()
{
static int _m_row=0,_m_col=0;
if(mouserow()==_m_row && mousecol()==_m_col)
return(0);
else
_m_row=mouserow();
_m_col=mousecol();
return(1);
}
setrow(int row)
{
union REGS inregs;
union REGS outregs;
inregs.x.ax = 4;
inregs.x.cx = mousecol()<<1;
inregs.x.dx = row;
int86(0x33,&inregs,&outregs);
}